package org.icop.virtdoc;

import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Tokenizer {
	
	private static Tokenizer eInstance = null;
	
	public static Tokenizer getInstance() {
		if (eInstance == null)
			eInstance = new Tokenizer();
		return eInstance;
	}
	
	
	private final String delimiters = " \t\n\r\f!~@#$%^&*()_+|`-=\\{}[]:\";'<>?,/.'1234567890";

	public List<String> tokenize(String s) {
		List<String> result = new ArrayList<String>();
		
		StringTokenizer stringTokenizer = new StringTokenizer(s,delimiters);
		while (stringTokenizer.hasMoreTokens()) {
			result.add(stringTokenizer.nextToken());
		}
		
		return result;
	}
}
